<template>
  <div>
    <slider class="tab">
      <span>
        <div class="width2R">

        </div>
      </span>
      <span>
        <div class="width2R">

        </div>
      </span>
      <span>
        <div class="width2R">

        </div>
      </span>
      <span>
        <div class="width2R">

        </div>
      </span>
      <span>
        <div class="width2R">

        </div>
      </span>
      <span>
        <div class="width2R">

        </div>
      </span>
      <span></span>
      <span></span>
      <span></span>
      <span></span>
      <span></span>
      <span></span>
      <span></span>
      <span></span>
      <span></span>
      <span></span>
      <span></span>
      <span></span>
    </slider>
    <yd-cell-group>
      <yd-cell-item>
        <span slot="left">用户名123456：</span>
        <yd-input slot="right" required v-model="input1" max="20" placeholder="请输入用户名"></yd-input>
      </yd-cell-item>
      <yd-cell-item>
        <span slot="left">密码：</span>
        <yd-input slot="right" type="password" v-model="input2" placeholder="请输入密码"></yd-input>
      </yd-cell-item>
    </yd-cell-group>
  </div>
</template>
<script>
/* eslint-disable no-undef,indent */

// import { uuid } from '@/assets/js/merge'
import { cookie } from '@/util/cookie' // 引用刚才我们创建的util.js文件，并使用getCookie方法
import { mapActions } from 'vuex';
import Slider from '@/base/slider'
export default {
  name: 'Login',
  data() {
    return {
      password: '',
      mobile: '',
      imageCode: '',
      uuid: '',
      loginImageCaptcha: '',
      input1: '',
      input2: ''
    }
  },
  methods: {
    ...mapActions({
      getUserInfo: 'getUserInfo'
    }),
    goLogin() {
      this.$post('/loginRegister/login', {
        'password': this.password,
        'mobile': this.mobile,
        'imgCode': this.imageCode,
        'uuidParam': this.uuid
      }).then((res) => {
        this.alert({
          text: res.resMsg
        })
        cookie('accountId', null)
        cookie('accountType', null)
        cookie('ifcToken', res.record.ifcToken)
        this.getUserInfo(this);
      })
    },
    getimgCode() {
      this.$post('loginRegister/getImageCaptcha', {
        'uuidParam': this.uuid
      }).then((res) => {
        console.log(res)
        this.loginImageCaptcha = 'data:image/jpg;base64,' + res.record.imageParam;
      })
    }
  },
  mounted() {
    this.$nextTick(() => {
    })
  },
  components: {
    Slider
  }
}
</script>
<style lang="stylus" scoped>
form
  width 500px
  margin 0 auto
.tab
  height 1rem
  font-size 0
  span
    display inline-block
    width 100px
    height 1rem
    border 1px solid #ccc
</style>
